package com.spark.colliery.module.mine.fragment

import android.os.Bundle
import android.text.method.HideReturnsTransformationMethod
import android.text.method.PasswordTransformationMethod
import android.view.View
import com.spark.colliery.R
import com.spark.common.BaseFragment
import kotlinx.android.synthetic.main.frag_forget_with_reset.*

/**
 * ForgetPassword that u gonna input the new password
 */

class ForgetWithResetFragment : BaseFragment() {
    companion object {
        fun newInstance(): ForgetWithResetFragment {
            return ForgetWithResetFragment()
        }
    }

    override fun contentResId(): Int {
        return R.layout.frag_forget_with_reset
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        btn_done.setOnClickListener { pop() }

        checkbox_password.setOnCheckedChangeListener { buttonView, isChecked ->
            if (isChecked) {
                et_password.transformationMethod = HideReturnsTransformationMethod.getInstance()
            } else {
                et_password.transformationMethod = PasswordTransformationMethod.getInstance()
            }
            et_password.setSelection(et_password.length())
        }

        checkbox_password_confirm.setOnCheckedChangeListener { buttonView, isChecked ->
            if (isChecked) {
                et_password_confirm.transformationMethod = HideReturnsTransformationMethod.getInstance()
            } else {
                et_password_confirm.transformationMethod = PasswordTransformationMethod.getInstance()
            }
            et_password_confirm.setSelection(et_password_confirm.length())
        }
    }


}
